#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

namespace GL
{
    enum Axis
    {
        X = 1,
        x = 2,
        Y = 3,
        y = 4,
        Z = 5,
        z = 6
    };
    class Camera
    {

    public:
        Camera();
        ~Camera();
        glm::mat4 LookAt(glm::vec3 &target);
        glm::mat4 &GetView() { return m_view; };

        void Move(Axis axis);
        void Update();
        void SetSpeed(float speed);
        void SetCursorPoint(double xPos, double yPos);

    private:
        void SetFront();

        // 欧拉角

        bool firstMouse = true;

        double xpos, ypos, lastX, lastY;
        float yaw, pitch;

        float m_speed = 0.05f;

        glm::mat4 m_view = glm::mat4(1.0f);

        // z 轴方向为屏幕由内指向外
        glm::vec3 position = glm::vec3(0.0f, 0.0f, 1.0f);

        // 由于摄像机总是看向z轴负方向 因此z 轴正方向 为 target - position
        // glm::vec3 ZDirection = glm::normalize(position - target);
        // 上方向
        glm::vec3 UpDirection = glm::vec3(0.0f, 1.0f, 0.0f);
        // x 轴正方向
        // glm::vec3 XDirection = glm::normalize(glm::cross(UpDirection, ZDirection));
        glm::vec3 FrontDirection = glm::vec3(0.0f, 0.0f, -0.1f);
        // y 轴正方向
        // glm::vec3 YDirection = (glm::cross(ZDirection, XDirection));
    };
}